package zozopo.business;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import zozopo.background.operator.operations.OperatorTB;
import zozopo.operations.business.StoreOS;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class DeleteStoreAction extends ActionSupport implements Action,SessionAware{
	
	
	private Map<Object, Object> session;
	
	private int id;
	
	public String execute(){
		
		///权限处理
		OperatorTB operator = (OperatorTB)session.get("operatorInfo"); 

		
		if(operator == null){
			addFieldError("errormessage", "用户未登陆或超时.请登陆后操作.");
			return NONE;
		} 
		
		StoreOS storeOS = new StoreOS();
		if(storeOS.deleteStoreById(id)){
			storeOS.releaseConnection();
			return SUCCESS;
		}else{
			storeOS.releaseConnection();
			return ERROR;
		}	
	}

	public void setSession(Map arg0) {
		// TODO Auto-generated method stub
		session = arg0;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
}
